import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { SWrestleGetRooms } from "../../../../../Message/Public/SWrestleGetRooms";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../mvc/ServerCommand";
import { SWrestleRoom } from "../../../../../Message/Public/SWrestleRoom";
type int = number;
//class WrestleRoomsCommand
    
    export  class WrestleRoomsCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SWrestleGetRooms;
            loc1.rooms.sort(this.sortRoom);
            NetDispatcher.dispatchCmd(ServerCommand.WrestleRoomsCommand, loc1);
            return;
        }

        /* internal  */sortRoom(arg1: SWrestleRoom, arg2: SWrestleRoom): int
        {
            if (arg1.minMark > arg2.minMark) 
            {
                return -1;
            }
            if (arg1.minMark < arg2.minMark) 
            {
                return 1;
            }
            return 0;
        }
    }
